<script>
	import store from './store/index';
	export default {
		onLaunch: function() {
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			getlocation() {
				uni.getLocation({
					type: 'gcj02',
					success: (res) => {
						var {
							latitude,
							longitude
						} = res;
						var location = {
							lat: latitude,
							lng: longitude,
						};
						uni.setStorageSync("location", location)
						
						store.commit("addlocation")
					
					},
					fail(res) {
						console.log(res)
						uni.showModal({
							content: '检测到您没打开此小程序的定位权限，是否去设置打开？',
							confirmText: "确认",
							cancelText: "取消",
							success: function(res) {
								//点击“确认”时打开设置页面
								if (res.confirm) {
									uni.openSetting({
										success: (res) => {
										
										}
									})
								} else {
									console.log('用户点击取消')
								}
							}
						})

					},
				})
			}
		}
	}
</script>

<style lang="scss">
	@import "uview-ui/index.scss";

	.cell-hover-class {
		background-color: rgb(235, 237, 238);
	}
</style>
